import React from "react";
import ReactDOM from "react-dom/client";
import "./index.scss";
import reportWebVitals from "./reportWebVitals";
import App from "@/App";
import locale from "antd/locale/zh_CN";
import dayjs from "dayjs";
import "dayjs/locale/zh-cn";
import { ConfigProvider } from "antd";
import type { ThemeData } from "./types/index.type";
dayjs.locale("zh-cn");

const defaultData: ThemeData = {
  borderRadius: 6,
  colorPrimary: "#4387FB",
  Button: {
    colorPrimary: "#4387FB",
  },
};

const defaultDataTheme = {
  token: {
    colorPrimary: defaultData.colorPrimary,
    borderRadius: defaultData.borderRadius,
  },
  components: {
    Button: {
      colorPrimary: defaultData.Button?.colorPrimary,
      algorithm: defaultData.Button?.algorithm,
    },
  },
};

const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement);
root.render(
  <React.StrictMode>
    <ConfigProvider locale={locale} theme={defaultDataTheme}>
      <App />
    </ConfigProvider>
  </React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
